package com.day22.Eatable;

public interface Eatable {
    void eat();
    public class EatableImpl implements Eatable{
        @Override
        public void eat() {
            System.out.println("吃饭");
        }

    }

    public class EatableDemo {
        public static void main(String[] args) {
            Eatable e=new EatableImpl() ;
            useEatable(e);
            useEatable(new Eatable() {
                @Override
                public void eat() {
                    System.out.println("吃饭");
                }
            });
            useEatable(()->{
                System.out.println("吃饭");
            });
        }
        private static void useEatable(Eatable e) {
            e.eat();
        }
    }
}
